<?php
require_once "./db_config.php";
$name=$_POST['name'];
$ryxz=$_POST['ryxz'];
if($ryxz!=0){
    $ryxz="'".$ryxz."'";
}
$arr=[];
if($name!="人员层级"&&$name!="管理职务"&&$name!="聘任职称"&&$name!="岗位类别"){
    $sql="SELECT DISTINCT
    `$name`
    FROM
    personalfiles";
    $result=mysqli_query($conn,$sql);
    if (mysqli_num_rows($result) > 0) {
    // 输出数据
        while($row = mysqli_fetch_array($result)) {
            array_push($arr,$row);
        }
    }
}
else{
    $sql="SELECT DISTINCT
    `$name`
    FROM
    personalfiles       
    WHERE
    `ryxz`=$ryxz";
    $result=mysqli_query($conn,$sql);
    if (mysqli_num_rows($result) > 0) {
    // 输出数据
        while($row = mysqli_fetch_array($result)) {
            array_push($arr,$row);
        }
    }
}
echo json_encode($arr,JSON_UNESCAPED_UNICODE);
mysqli_close($conn);
?>